<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<table border="1" cellspacing="0" cellpadding="10px" id='tableId' >
			<tr><th></th>
			<th>姓名</th>
			<th>性别</th>
			<th>年龄</th>
			<th>家庭住址</th></tr>
			
			<tr><td><input type="checkbox" name="stu" id="" value="1" /></td>
			<td>张工</td>
			<td>男</td>
			<td>19</td>
			<td>福建省龙岩市新罗区</td>
			</tr>
			<tr><td><input type="checkbox" name="stu" id="" value="1" /></td>
			<td>张飞</td>
			<td>男</td>
			<td>29</td>
			<td>福建省龙岩市新罗区</td>
			</tr>
			<tr><td><input type="checkbox" name="stu" id="" value="2" /></td>
			<td>张丽</td>
			<td>女</td>
			<td>19</td>
			<td>福建省龙岩市新罗区</td>
			</tr>
			、<tr><td><input type="checkbox" name="stu" id="" value="2" /></td>
			<td>张晓飞</td>
			<td>女</td>
			<td>29</td>
			<td>福建省龙岩市新罗区</td>
			</tr>
			<tr><td><input type="checkbox" name="stu" id="" value="1" /></td>
			<td>张骰</td>
			<td>男</td>
			<td>19</td>
			<td>福建省龙岩市新罗区</td>
			</tr>
		</table>
		<td><input type="checkbox" name="" id="checkAllID" value="" onclick="aa();" /></td>全选
		<td><input type="checkbox" name="" id="checkAllID2" value="" onclick="bb();" /></td>男全选
		<td><input type="checkbox" name="" id="checkAllID3" value="" onclick="cc();" /></td>女全选
		<button type="submit">删除</button>
	</body>
	<script type="text/javascript">
		function aa(){
			var tableOjb = document.getElementById('tableId');
			var allSelInput = tableOjb.getElementsByTagName('input');
			var checkAllIDValue = document.getElementById('checkAllID');
			for(var i=0;i<allSelInput.length;i++){
				allSelInput[i].checked = checkAllIDValue.checked;
			}
			}
			function bb(){
				var tableOjb2 = document.getElementById('tableId');
				var allSelInput2 = tableOjb2.getElementsByTagName('input');
				var checkAllIDValue2 = document.getElementById('checkAllID2');
				for(var i=0;i<allSelInput2.length;i++){
					if(allSelInput2[i].value == '1'){
						allSelInput2[i].checked = checkAllIDValue2.checked;
						
					}
					
				}
				}
				function cc(){
					var tableOjb3 = document.getElementById('tableId');
					var allSelInput3 = tableOjb3.getElementsByTagName('input');
					var checkAllIDValue3 = document.getElementById('checkAllID3');
					for(var i=0;i<allSelInput3.length;i++){
					if(allSelInput3[i].value == '2'){
						allSelInput3[i].checked = checkAllIDValue3.checked;
					}
						}
					}
					
	</script>
</html>
